package com.sevenGroup.pawnshop.controller;


import com.sevenGroup.pawnshop.Utils.Result;
import com.sevenGroup.pawnshop.controller.form.AccountAndUserForm;
import com.sevenGroup.pawnshop.model.Roles;
import com.sevenGroup.pawnshop.service.RolesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sevenGroup
 * @since 2022-02-16
 */
@RestController
@RequestMapping("/roles")
@Api(tags="角色相关")
public class RolesController {

    @Resource
    private RolesService rolesService;

    @ApiOperation("查询所有角色")
//  查询所有角色
    @PostMapping("selectAllRoles")
    @PreAuthorize("hasAnyAuthority('boss','shopManage','worker')")
    public Result selectAllRoles(){
        List<Roles> list = rolesService.list();
        return Result.success(list);
    }

}

